//////////////////////////////////////////////////////////////////////////
// Author:		Dan Polak
// Date:		3/25/2011
// Last Mod:	N/A
//
// File:		Game.h
//
// Purpose:		
//////////////////////////////////////////////////////////////////////////

#ifndef _GAME_H
#define _GAME_H

//Library Files
#include <vector>

//My Files
//#include "Objects.h"
#include "Math.h"

//Forward Declerations
class CCamera;
class COBJManager;
struct vec3f;
class CPlayer;
class CGun;

//DEBUG ONLY
struct Cylinder;

class CGame
{
private:
	//Instance of this class to maintain it as a singleton
	static CGame* m_pInstance;

	//Player
	CPlayer*	m_pPlayer;
	CGun*		m_pGun;

	//Input
	bool m_bBuffKeysUp[16];

	//Temp
	vec3f		m_vTranslation;		//Used for storing camera translation values

	vec3f		m_vWorldY;			//Used for mouse movement calculations
	matrix4f	m_vTempMat;			//Used for mouse movement calculations

	//Screen Information
	int		m_nScreenWidth;
	int		m_nScreenHeight;

	//Camera
	CCamera* m_pMyCam;

	//Object Manager
	COBJManager* m_pOBJManager;

	//Player Position
	vec3f m_vPreviousPos;

	//DEBUG ONLY
	bool m_bFirstPerson;
	vec3f m_vPlayerPos;
	Cylinder* m_pPlayerCylinder;

	//Buffered debug input
	bool m_bSwitchViewKeyDown;

protected:
	void SetUpLighting();
	void RenderHUD();

public:
	//Mutators
	void SetScreenHeight(int n)		{m_nScreenHeight = n;}
	void SetScreenWidth(int n)		{m_nScreenWidth = n;}
	void SetPreviousPos(vec3f v)	{m_vPreviousPos = v;}
	void SetPlayerPos(vec3f v);		

	//Accessor
	vec3f GetPreviousPos()	{return m_vPreviousPos;}

	//////////////////////////////////////////////////////////////////////////
	//	Function:	GetInstance
	//
	//	Purpose:	Returns an instance of the class to be used in other classes.
	//
	//	Paramaters:	N/A
	//////////////////////////////////////////////////////////////////////////
	static CGame* GetInstance(void);

	//////////////////////////////////////////////////////////////////////////
	//	Function:	Init
	//
	//	Purpose:	Initialize the class. This will handle the initializing 
	//				of all member variables.
	//
	//	Paramaters:	N/A
	//////////////////////////////////////////////////////////////////////////
	void GameInit(void);


	//////////////////////////////////////////////////////////////////////////
	//	Function:	Input
	//
	//	Purpose:	Takes all base input for the program. Will use a delta time
	//				for some input functionality including moving a box with 
	//				the mouse.
	//
	//	Paramaters:	fDeltaTime	- Delta Time :)
	//////////////////////////////////////////////////////////////////////////	
	void Input(float fDeltaTime);

	//////////////////////////////////////////////////////////////////////////
	//	Function:	Update
	//
	//	Purpose:	Updates everything to do with the builder. This includes,
	//				helper classes, rendering and calling input.
	//
	//	Paramaters:	fDeltaTime	- Delta Time :)
	//////////////////////////////////////////////////////////////////////////
	void Update(float fDeltaTime);

	//////////////////////////////////////////////////////////////////////////
	//	Function:	Render
	//
	//	Purpose:	Draws all of the on Screen Items
	//
	//	Paramaters:	N/A
	//////////////////////////////////////////////////////////////////////////
	void Render();

	//////////////////////////////////////////////////////////////////////////
	//	Function:	MouseLook
	//
	//	Purpose:	Takes mouse input to rotate the camera with.
	//
	//	Paramaters:	fDeltaTime	- Used to give a smooth rotation feeling.
	//////////////////////////////////////////////////////////////////////////
	void MouseLook(float fDeltaTime);

	//////////////////////////////////////////////////////////////////////////
	//	Function:	Ground Clamp
	//
	//	Purpose:	Clamp the Player to the ground.
	//
	//	Paramaters:	vPos	- Clamps the player's y position to the ground.
	//////////////////////////////////////////////////////////////////////////
	void GroundClamp(vec3f vPos);

	//Shooting
	void Shoot();

	void DrawGround();
	//void DrawCastleWalls();
};

#endif